<?php
/* @var $this MobileController */
/* @var $model Mobile */

$this->breadcrumbs=array(
	'Mobiles'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'号段管理', 'url'=>array('index')),
	array('label'=>'添加号段', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#mobile-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});

$('#selectcity').on('change',function() {
	var url = location.href;
	if (url.indexOf('Mobile[area]') > -1){
		url = url.substring(0,url.indexOf('Mobile[area]')-1);
	}

	location.href=url+'&Mobile[area]='+encodeURI($('#selectcity').val());
});

");
?>

<h1>Manage Mobiles</h1>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php
echo CHtml::dropDownList('selectcity','', Globals::province(),array('empty'=>array('all'=>'全国')));

$this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'mobile-grid',
	'dataProvider'=>$model->search(),
	 
	'columns'=>array(
		 
		'mobile',
		'area',
		'type',
		'areacode',
		'postcode',
		 
		array(
		'name'=>'postion',
		'value'=>'$data->times.",".$data->postion',
		), 
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>
